<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>问卷管理列表</title>
		<%@ include file="/include/resources.jsp" %>
	</head>
	<body>
		<script type="text/javascript" src="msi/questionnaire/naire.js"></script>
		<input type="hidden" id="_projectId" value="<s:property value='naire.projectId'/>">
		<div style="padding:5px;background:#fafafa;border-bottom:1px solid #eee;">
			<table cellpadding="0" cellspacing="0" style="width:100%">
				<tr>
					<td style="text-align:left">
						<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-add" onclick="openNairePage();">新建</a>
						<a href="#" id="firstAut" class="easyui-linkbutton" plain="true" iconCls="icon-ok" onclick="firstAut();">一审</a>
						<a href="#" id="secondAut" class="easyui-linkbutton" plain="true" iconCls="icon-ok" onclick="secondAut();">二审</a>
						<a href="#" id="invalid" class="easyui-linkbutton" plain="true" iconCls="icon-remove" onclick="invalidNaire();">作废</a>
					</td>
					<td style="text-align:right">
						<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-cancel" onclick="javascript:$('#questionnaireManagerDialog').dialog('close')">关闭</a>
					</td>
				</tr>
			</table>
		</div>
		<div style="padding:10px;height: 340px">
			<table id="naireList" idField="naireId" fit="true" singleSelect="true" pagination="true" rownumbers="true">
				<thead>
					<tr>
						<th field="naireId" hidden="true">问卷ID</th>
						<th field="chkOrgName" width="130">机构名称</th>
						<th field="semTime" width="80">调查时间</th>
						<th field="userName" width="80">调研人员</th>
						<th field="createTime" width="80">创建时间</th>
					</tr>
				</thead>
			</table>
		</div>
		<script type="text/javascript">
			$(function(){
				var _projectId = $("#_projectId").val();
				$('#naireList').datagrid({
					width : 660,
					pagination:true,
					url:"searchNaire.do?naire.projectId="+_projectId,
					onDblClickRow:function(rowIndex, rowData) {
						var state = rowData.naireState;
						if(state != 'F') {
							openNairePage(rowData.naireId);
						}
					},
					onClickRow:function(rowIndex, rowData) {
						var state = rowData.naireState;
						if(state == 'Y') {
							$("#firstAut").linkbutton('enable');
							$("#invalid").linkbutton('enable');
							$("#secondAut").linkbutton('disable');
						} else if(state == 'A') {
							$("#firstAut").linkbutton('disable');
							$("#invalid").linkbutton('disable');
							$("#secondAut").linkbutton('enable');
						} else if(state == 'F') {
							$("#firstAut").linkbutton('disable');
							$("#invalid").linkbutton('disable');
							$("#secondAut").linkbutton('disable');
						}
					}
				});
			});
		</script>
	</body>
</html>